 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Cache-Control" content="No-Cache">
	<meta http-equiv="Pragma" content="No-Cache">

	<title>운세의 신</title>

	<link rel="stylesheet" type="text/css" href="/css/common.css">
	<link rel="stylesheet" type="text/css" href="/css/sub.css">
    <link rel="stylesheet" type="text/css" href="/css/mypage.css">
	
	<link href="/css/lib/myconfig.jquery.validate.css" rel="stylesheet" type="text/css"/>
	
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
	<script src="/js/lib/jquery.validate.min.js" type="text/javascript"></script>
	<script src="/js/lib/jquery.meio.mask.min.js" type="text/javascript"></script>
	<script src="/js/lib/myconfig.jquery.meio.mask.js" type="text/javascript"></script>
	<script src="/js/utility/common_util.js" type="text/javascript"></script>

	<script type="text/javascript">
		$(document).ready(function() {
			$('input:text').setMask();

			$('#search_zipcode').click(function() {
				openPopup("/member/zipcode", 450,460);
			});

			$('#email_select').change(function() {
				$("#email_select option:selected").each(function () {
					var email_1 = $('#email').val();
					var email_2 = $(this).val();
					
					if (email_1.length > 0) {
						var atIndex = email_1.indexOf('@');
						if (atIndex >= 0) {
							email_1 = email_1.substring(0, atIndex);
						}
					}
					
					var email = email_1 + '@' + email_2;
					$('#email').val(email);
					$('#email').focus();
				});
			});

			// 폼 전송시 유효성 체크
			$("#frm").validate({
				rules: {
					nickname: {
						required: true,
						minlength: 2,
						remote: {
							url: "/mypage/change/nickname_check",
							type: "post"
						}
					},
				    birth_yyyy: {
						required: true
				    },
				    birth_mm: {
						required: true
				    },
				    birth_dd: {
						required: true
				    },
					birth_hh: {
						required: true
					},
					birth_solunar: {
						required: true
					},
				    email: {
				    	required: true,
				    	email: true,
						remote: {
							url: "/mypage/change/email_check",
							type: "post"
						} 
				    }
				},
				messages: {
					nickname: {
						required: "닉네임을 입력해 주세요.",
						minlength: "2자리 이상 입력하세요.",
						remote: "이미 존재하는 닉네임입니다."
					},
				    birth_yyyy: {
						required: "생년월일을 입력하세요."
					},
					birth_mm: {
						required: "생월을 입력하세요."
					},
					birth_dd: {
						required: "생일을 입력하세요."
					},
					birth_hh: {
						required: "출생시간을 선택하세요."
					},
					birth_solunar: {
						required: "음/양력을 선택하세요."
					},
				    email: {
				    	required: "이메일을 입력하세요.",
				    	email : "올바른 이메일을 입력하세요.",
				    	remote : "이미 등록된 이메일입니다."
				    }
				},
				submitHandler: function(form) {
					var cellphone =  $('#cell_1').val()+"-"+$('#cell_2').val()+"-"+$('#cell_3').val();
					if (cellphone.length >= 12) {
						$('#cellphone').val(cellphone);
					}
					$('#birthdate').val( $('#birth_yyyy').val()+"-"+$('#birth_mm').val()+"-"+$('#birth_dd').val() );


					var userfile = $("#userfile").val();

					if (userfile != '' && !(/.*\.(gif)|(jpg)$/.test(userfile.toLowerCase()))) {
						alert('업로드 할수 없는 파일입니다.');
					} else {
						form.submit();
					}
				}
			});
		});
	</script>
</head>
<body>
<div id="wrap">
	<!-- Header -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/main_header.php'; ?>
	<!--// Header -->

	<!--커튼 데코레이션-->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/drape.php'; ?>
	<!--//커튼 데코레이션-->
	
	<!--컨텐츠-->
	<div id="content">
		<!--휘장-->
		<div class="keybox1">
		</div>
		<!--휘장-->

		<!--왼쪽 컨텐츠-->
		<div class="assistant">
			<!--왼쪽 메뉴-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/inc_lnb.php'; ?>
			<!--// 왼쪽 메뉴-->
			
			<!--추천테마-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/theme.php'; ?>
			<!--//추천테마-->
			
			<!--오늘의 추천! 무료운세-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/free.php'; ?>
			<!--//오늘의 추천! 무료운세-->
			
			<!--후기게시판-->
            <div class="side">
			<?php echo $INC_POSTSCRIPT_LIST ?>
            </div>
			<!--//후기게시판-->
			
			<!--회원배너-->
			<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/static/member_join.php'; ?>
			<!--//회원배너-->
		</div>
		<!--//왼쪽 컨텐츠-->

		<!-- 메인컨텐츠-->
		<div class="cont">
			 <div class="mypage">
				<h3>회원정보수정</h3>
				<div class="text">
					<ul>
						<li>회원님의 정보 중 변경된 내용이 있는 경우, 아래에서 수정해주세요. </li>
					</ul>
				</div>
				<form name="frm" id="frm" method="post" enctype="multipart/form-data" action="/mypage/change/info_ok">
					<input type="hidden" name="idx" value="<?=$member['idx']?>" />
					<div class="profile">
						<h4><img src="/images/mypage/sstit_proinfo.png" alt="프로필 변경" /></h4>
						<dl>
							<dt><img src="<?=$member_img_url?>" alt="회원사진"/></dt>
						   	<dd>
						   		프로필 이미지로 설정할 사진을 선택하세요.<br />
						   		첨부파일은 JPG, GIF 이미지 파일만 등록 가능합니다.<br />
						   		용량은 1MB이하, 해상도는 가로 1920, 세로 1080 픽셀만 등록 가능합니다.
						   	</dd>
							<!--<dd><a href="#"><img src="/images/common/board/bt_plus.png" alt="프로필이미지찾아보기" /></a></dd>-->
							<dd><input type="file" name="userfile" id="userfile" src="/images/common/board/bt_plus.png"  onchange="fileUploadImgCheck(this)"/ style="height:23px;"></dd>
							<dd class="gtext">연예인의 사진을 무단 등록할 경우, 법적인 제재를 받을 수 있습니다.</dd>
						</dl> 
					</div>
					<div class="joinField">
						<fieldset>
							<legend>기본정보입력영역</legend>
							<h4><img src="/images/mypage/sstit_chageinfo.png" alt="기본정보 변경" /></h4>
							<p class="joinFieldText">입력하신 개인정보는 회원님의 동의 없이 제3자에게 제공되지 않으며, 개인정보취급방침에 따라 보호되고 있습니다.</p>
						
							<table width="100%" summary="" cellpadding="0" cellspacing="0">
								<colgroup>
									<col width="140" />
									<col width="*" />
								</colgroup>
								<tbody>
									<tr>
										<th scope="row">
											<label for="user_name">이름</label>
											<span class="warning">*</span>
										</th>
										<td><?=$member['user_name']?></td>
									</tr>
									<tr>
										<th scope="row">
											<label for="user_id">회원아이디</label>
											<span class="warning">*</span>
										</th>
										<td><?=$member['user_id']?></td>
									</tr>
									<tr>
										<th scope="row">
											<label for="nickname">닉네임</label>
											<span class="warning">*</span>
										</th>
										<td>
											<input type="text" name="nickname" id="nickname" maxlength="20" value="<?=$member['nickname']?>" title="닉네임 입력하세요."  class="inpText" />
											<span>닉네임은 2 ~ 12자 이내로 작성해 주세요.</span>
											<br/><label class="error" for="nickname" generated="true"></label>
										</td>
									</tr>
									<tr>
										<th scope="row">
											<label for="user_sex">성별</label>
										</th>
										<td>
											<input type="radio" name="sex" id="sex_m" class="input_radio" value="M" <? if ($member['sex'] == 'M') { ?>checked="checked"<? } ?> />
											<label for="sex_m">남자</label>
											<input type="radio" name="sex" id="sex_f" class="input_radio" value="F" <? if ($member['sex'] == 'F') { ?>checked="checked"<? } ?> />
											<label for="sex_f">여자</label>
										</td>
									</tr>
									<tr>
										<th scope="row">
											<label for="user_birth">사주정보</label>
										</th>
										<td>
											<select name="birth_yyyy" id="birth_yyyy" title="출생년도를 선택하세요" class="input_select">
												<option value="">출생년도</option>
<?	for ($year = 1930; $year <= 2012; $year++) : ?>
												<option value="<?=$year?>" <?=$member['birth_yyyy'] == $year ? 'selected="selected"' : '';?>><?=$year?></option>
<?	endfor ?>
											</select>년
											<select name="birth_mm" id="birth_mm" title="출생월을 선택하세요" class="input_select">
												<option value="">출생월</option>
<?	for ($month = 1; $month <= 12; $month++) : ?>
<?		$str_month = str_pad($month, 2, '0', STR_PAD_LEFT); ?>
												<option value="<?=$str_month?>" <?=$member['birth_mm'] == $str_month ? 'selected="selected"' : '';?>><?=$month?></option>
<?	endfor ?>
											</select>월
											<select name="birth_dd" id="birth_dd" title="출생일을 선택하세요" class="input_select">
												<option value="">출생일</option>
<?	for ($day = 1; $day <= 31; $day++) : ?>
<?		$str_day = str_pad($day, 2, '0', STR_PAD_LEFT); ?>
												<option value="<?=$str_day?>" <?=$member['birth_dd'] == $str_day ? 'selected="selected"' : '';?>><?=$day?></option>
<?	endfor ?>
											</select>일
											<select name="birth_hh" id="birth_hh" title="출생시간을 선택하세요" class="input_select">
												<option value="0" <?=$member['birthtime'] == '0' ? 'selected="selected"' : ''?>>모름</option>
												<option value="01" <?=$member['birthtime'] == '01' ? 'selected="selected"' : ''?>>子 (23:30 ~ 01:29)</option>
												<option value="02" <?=$member['birthtime'] == '02' ? 'selected="selected"' : ''?>>丑 (01:30 ~ 03:29)</option>
												<option value="04" <?=$member['birthtime'] == '04' ? 'selected="selected"' : ''?>>寅 (03:30 ~ 05:29)</option>
												<option value="06" <?=$member['birthtime'] == '06' ? 'selected="selected"' : ''?>>卯 (05:30 ~ 07:29)</option>
												<option value="08" <?=$member['birthtime'] == '08' ? 'selected="selected"' : ''?>>辰 (07:30 ~ 09:29)</option>
												<option value="10" <?=$member['birthtime'] == '10' ? 'selected="selected"' : ''?>>巳 (09:30 ~ 11:29)</option>
												<option value="12" <?=$member['birthtime'] == '12' ? 'selected="selected"' : ''?>>午 (11:30 ~ 13:29)</option>
												<option value="14" <?=$member['birthtime'] == '14' ? 'selected="selected"' : ''?>>未 (13:30 ~ 15:29)</option>
												<option value="16" <?=$member['birthtime'] == '16' ? 'selected="selected"' : ''?>>申 (15:30 ~ 17:29)</option>
												<option value="18" <?=$member['birthtime'] == '18' ? 'selected="selected"' : ''?>>酉 (17:30 ~ 19:29)</option>
												<option value="20" <?=$member['birthtime'] == '20' ? 'selected="selected"' : ''?>>戌 (19:30 ~ 21:29)</option>
												<option value="22" <?=$member['birthtime'] == '22' ? 'selected="selected"' : ''?>>亥 (21:30 ~ 23:29)</option>
											</select>시
											<select name="birth_solunar" id="birth_solunar" title="음/양을 선택하세요" class="input_select">
												<option value="S_C" <?=$member['birth_solunar'] == 'S' && $member['cl_year'] == 'C' ? 'selected="selected"' : ''?>>양력</option>
												<option value="L_C" <?=$member['birth_solunar'] == 'L' && $member['cl_year'] == 'C' ? 'selected="selected"' : ''?>>음력(평년)</option>
												<option value="L_L" <?=$member['birth_solunar'] == 'L' && $member['cl_year'] == 'L' ? 'selected="selected"' : ''?>>음력(윤년)</option>
											</select>
											<input type="hidden" name="birthdate" id="birthdate" />
											<br><label class="error" for="birth_yyyy" generated="true"></label>
											<label class="error" for="birth_mm" generated="true"></label>
											<label class="error" for="birth_dd" generated="true"></label>
											<label class="error" for="birth_hh" generated="true"></label>
											<label class="error" for="birth_solunar" generated="true"></label>
										</td>
									</tr>
									<tr>
										<th scope="row">
											<label for="user_email">이메일 주소</label>
											<span class="warning">*</span>
										</th>
										<td>
											<input type="text" name="email" id="email" value="<?=$member['email']?>" title="이메일을 작성하세요." class="inpText"/>
											<select id="email_select" name="email_select" title="이메일 도메인을 선택하세요.">
												<option value="">직접입력</option>
												<option value="naver.com">naver.com</option>
												<option value="nate.com">nate.com</option>
												<option value="hanmail.net">hanmail.net</option>
												<option value="gmail.com">gmail.com</option>
												<option value="paran.com">paran.com</option>
												<option value="yahoo.co.kr">yahoo.co.kr</option>
												<option value="dreamwiz.com">dreamwiz.com</option>
												<option value="empal.com">empal.com</option>
												<option value="hotmail.com">hotmail.com</option>
												<option value="korea.com">korea.com</option>
												<option value="lycos.co.kr">lycos.co.kr</option>
											</select>
											<!--a href="#"><img src="/images/member/bt_join_check.png" alt="중복확인" align="absmiddle" /></a-->
											<input type="checkbox" class="input_check" id="mailing_yn" name="mailing_yn" value="Y" <?=$member['mailing_yn'] == 'Y' ? 'checked="checked"' : ''?> />
											<label for="mailing_yn">메일수신동의</label>
											<br/><label class="error" for="email" generated="true"></label>
										</td>
									</tr>
									<tr>
										<th scope="row">
											<label for="num_adress">우편번호</label>
										</th>
										<td>
											<input type="text" name="zip_code" id="zip_code" size="7" readonly="readonly" value="<?=$member['zip_code']?>" title="우편번호를 검색하세요" class="inpText" />
											 <a href="javascript:;" name="search_zipcode" id="search_zipcode"><img src="/images/member/bt_join_adress.png" align="absmiddle" alt="우편번호검색" /></a>
										</td>
									</tr>
									<tr>
										<th scope="row">
											<label for="adress">주소</label>
										</th>
										<td>
											<input type="text" name="addr1" id="addr1" size="50" readonly="readonly" value="<?=$member['addr1']?>" title="우편번호 찾기를 통해 주소를 입력하세요." class="inpText bottom" />
                                            <p></p>
											<input type="text" name="addr2" id="addr2" size="50" maxlength="100" value="<?=$member['addr2']?>" title="상세주소를 입력하세요." class="inpText bottom" />
										</td>
									</tr>
									<tr>
										<th scope="row">
											<label for="user_mobile">휴대번호</label>
										</th>
										<td>
											<select name="cell_1" id="cell_1" title="서비스 번호를 선택하세요" class="input_select">
												
												<option value="<?=$member['cell_1']?>"><?=$member['cell_1']?></option>
												<option value="010">010</option>
												<option value="011">011</option>
												<option value="016">016</option>
												<option value="017">017</option>
												<option value="018">018</option>
												<option value="019">019</option>
											</select>
											 - 
											<input type="text" name="cell_2" id="cell_2" size="12" value="<?=$member['cell_2']?>" title="전화번호 가운데자리를 입력하세요." alt="phone" class="inpText" />
											 - 
											<input type="text" name="cell_3" id="cell_3" size="12" value="<?=$member['cell_3']?>" title="전화번호 뒷자리를 입력하세요." alt="phone" class="inpText" />
											<input type="checkbox" class="input_check" id="sms_yn" name="sms_yn" value="Y" <?=$member['sms_yn'] == 'Y' ? 'checked="checked"' : ''?> />
											<label for="sms_yn">SMS 수신 동의</label>
											<input type="hidden" name="cellphone" id="cellphone" />
										</td>
									</tr>
								</tbody>
							</table>
						</fieldset>
					</div><!--joinField-->
					
					<div class="bt_area">
						<input type="image" src="/images/common/bt_ok.png" alt="확인" class="yes" />
						<a href="javascript:;" onclick="location.href='/';" class="btno"><img src="/images/common/bt_cancle.png" alt="취소" /></a>
					</div> 
				</form>
			</div><!--mypage--> 
		</div>
		<!--// 메인컨텐츠-->
	</div>
	<!--컨텐츠-->

	<!-- Footer -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/main_footer.php'; ?>
	<!--// Footer -->
</div>
</body>
</html>